/**
 * 
 */
package leetCode;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author zhongfang
 *
 */
public class KeyboardRow {
    public static String[] findWords(String[] words) {
    	int[] char2Line=new int[26];
    	char2Line[0]=char2Line['s'-'a']=char2Line['d'-'a']=char2Line['f'-'a']=char2Line['g'-'a']=char2Line['h'-'a']=char2Line['j'-'a']=char2Line['k'-'a']=char2Line['l'-'a']=2;
    	char2Line['q'-'a']=char2Line['w'-'a']=char2Line['e'-'a']=char2Line['r'-'a']=char2Line['t'-'a']=char2Line['y'-'a']=char2Line['u'-'a']=char2Line['i'-'a']=char2Line['o'-'a']=char2Line['p'-'a']=1;
    	char2Line['z'-'a']=char2Line['x'-'a']=char2Line['c'-'a']=char2Line['v'-'a']=char2Line['b'-'a']=char2Line['n'-'a']=char2Line['m'-'a']=3;
    	List<String> reStrings=new ArrayList<>();
    	for (String string : words) {
    		int line=char2Line[Character.toLowerCase(string.charAt(0))-'a'];
    		boolean isTrue=true;
			for (int i = 0; i < string.length(); i++) {
				if(char2Line[Character.toLowerCase(string.charAt(i))-'a']!=line){
					isTrue=false;
					break;
				}
			}
			if(isTrue){
				reStrings.add(string);
			}
		}
    	String[] result=new String[reStrings.size()];
    	for (int i = 0; i < result.length; i++) {
			result[i]=reStrings.get(i);
		}
    	return reStrings.toArray(new String[0]);
    }
	/**
	 * @param args
	 */
	public static void main(String[] args) {
//		String[] words={"Hello", "Alaska", "Dad", "Peace"};
//		words=findWords(words);
//		for (String string : words) {
//			System.out.println(string);
//		}
    	int i=7;
    	int j=i&1;
    	System.out.println(j);
	}

}
